package it.spoli.generator;

import it.spoli.talkMe.Package;
import it.spoli.talkMe.System;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.StringExtensions;
import org.eclipse.xtext.xtend2.lib.ResourceExtensions;
import org.eclipse.xtext.xtend2.lib.StringConcatenation;

@SuppressWarnings("all")
public class TalkMeGenerator implements IGenerator {
  
  public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
    Iterable<EObject> _allContentsIterable = ResourceExtensions.allContentsIterable(resource);
    Iterable<System> _filter = IterableExtensions.<System>filter(_allContentsIterable, it.spoli.talkMe.System.class);
    for (final System s : _filter) {
      {
        Package _package = s.getPackage();
        String _name = _package.getName();
        String _string = _name.toString();
        String _replace = _string.replace(".", "/");
        String _operator_plus = StringExtensions.operator_plus(_replace, "/");
        final String packageName = _operator_plus;
        String _name_1 = s.getName();
        String _firstUpper = StringExtensions.toFirstUpper(_name_1);
        String _operator_plus_1 = StringExtensions.operator_plus(packageName, _firstUpper);
        String _operator_plus_2 = StringExtensions.operator_plus(_operator_plus_1, ".java");
        StringConcatenation _compile = this.compile(s);
        fsa.generateFile(_operator_plus_2, _compile);
      }
    }
  }
  
  public StringConcatenation compile(final System s) {
    StringConcatenation _builder = new StringConcatenation();
    return _builder;
  }
}